
import Request from "@/utils/request.js"

export const getAccessToken = (params)=>{ 
	return new Promise(async (resolve,reject) =>{
		Request.get('/qy-wechat/get/access_token',params).then(res=>{
			resolve(res.data)
		})
	})
}

// 获取企业微信授权后的用户信息
export const getAuthUserInfo = (params,callback)=>{ 
	return new Promise(async (resolve,reject) =>{
		Request.post('/qy-wechat/get/auth/user',params).then(res=>{
			resolve(res.data)
		})
	})
}

// 通过手机号获取企业员工的userid
export const getUserid = (params,callback)=>{ 
	return new Promise(async (resolve,reject) =>{
		Request.post('/qy-wechat/get/userid',params).then(res=>{
			resolve(res.data)
		})
	})
}
// 获取客户扫描加入二维码（以企业某个员工生成加入二维码）
export const getJoinQrCode = (params,callback)=>{ // 
	return new Promise(async (resolve,reject) =>{
		Request.post('/qy-wechat/create/qr_code',params).then(res=>{
			resolve(res.data)
		})
	})
}

// 获取客户列表
export const getCustomList = (params,callback)=>{ // 
	return new Promise(async (resolve,reject) =>{
		Request.post('/qy-wechat/get/custom/list2',params).then(res=>{
			resolve(res.data)
		})
	})
}

// 获取客户详情
export const getCustomDetail = (params,callback)=>{ // 
	return new Promise(async (resolve,reject) =>{
		Request.post('/qy-wechat/get/custom/detail',params).then(res=>{
			resolve(res.data)
		})
	})
}

// 创建预约会议
export const createMeeting = (params,callback)=>{ // 
	return new Promise(async (resolve,reject) =>{
		Request.post('/qy-wechat/meeting/create',params).then(res=>{
			resolve(res.data)
		})
	})
}

// 获取会议详情
export const getMeetingDetail = (params,callback)=>{ // 
	return new Promise(async (resolve,reject) =>{
		Request.post('/qy-wechat/get/meeting/detail',params).then(res=>{
			resolve(res.data)
		})
	})
}

// 内部人员消息推送
export const sendMessage = (params,callback)=>{ // 
	return new Promise(async (resolve,reject) =>{
		Request.post('/qy-wechat/send/internal/message',params).then(res=>{
			resolve(res.data)
		})
	})
}

// 创建朋友圈消息
export const createMessageToFriendsCircle = (params,callback)=>{ // 
	return new Promise(async (resolve,reject) =>{
		Request.post('/qy-wechat/friends-circle/message/add',params).then(res=>{
			resolve(res.data)
		})
	})
}

// 获取内部成员列表（从腾讯接口获取）
export const getMemberList = (params,callback)=>{ // 
	return new Promise(async (resolve,reject) =>{
		Request.post('/qy-wechat/get/member/list',params).then(res=>{
			resolve(res.data)
		})
	})
}

// 获取内部成员列表(从数据库获取)
export const getMemberList2 = (params,callback)=>{ // 
	return new Promise(async (resolve,reject) =>{
		Request.post('/boss/member/list',params).then(res=>{
			resolve(res.data)
		})
	})
}

// 获取内部成员id列表
export const getMemberIdList = (params,callback)=>{ // 
	return new Promise(async (resolve,reject) =>{
		Request.post('/qy-wechat/get/member/id-list',params).then(res=>{
			resolve(res.data)
		})
	})
}

// 获取企业微信成员信息
export const getMemberInfo = (params,callback)=>{ // 
	return new Promise(async (resolve,reject) =>{
		Request.post('/qy-wechat/get/member/info',params).then(res=>{
			resolve(res.data)
		})
	})
}

// 同步成员的客户数据
export const syncCustomByUserid = (params,callback)=>{ // 
	return new Promise(async (resolve,reject) =>{
		Request.post('/boss/sync/data/custom-list',params).then(res=>{
			resolve(res.data)
		})
	})
}

// 修改成员信息
export const updateMember = (params,callback)=>{ // 
	return new Promise(async (resolve,reject) =>{
		Request.post('/boss/member/edit',params).then(res=>{
			resolve(res.data)
		})
	})
}

// 标签列表
export const getTagList = (params,callback)=>{ // 
	return new Promise(async (resolve,reject) =>{
		Request.post('/qy-wechat/get/custom/tag-list',params).then(res=>{
			resolve(res.data)
		})
	})
}

// 标签列表
export const getBehaviorData = (params,callback)=>{ // 
	return new Promise(async (resolve,reject) =>{
		Request.post('/qy-wechat/get/member/behavior-data',params).then(res=>{
			resolve(res.data)
		})
	})
}

// 虎丘部门列表
export const getDepartmentList = (params,callback)=>{ // 
	return new Promise(async (resolve,reject) =>{
		Request.post('/qy-wechat/get/department-list',params).then(res=>{
			resolve(res.data)
		})
	})
}

export const customCount = (params,callback)=>{ // 
	return new Promise(async (resolve,reject) =>{
		Request.post('/qy-wechat/custom/count',params).then(res=>{
			resolve(res.data)
		})
	})
}

export const get_moment_list = (params,callback)=>{ // 
	return new Promise(async (resolve,reject) =>{
		Request.post('/qy-wechat/get/moment_list',params).then(res=>{
			resolve(res.data)
		})
	})
}

export const get_groupmsg_list = (params,callback)=>{ // 
	return new Promise(async (resolve,reject) =>{
		Request.post('/qy-wechat/get/groupmsg_list',params).then(res=>{
			resolve(res.data)
		})
	})
}

export const get_company_list = (params,callback)=>{ // 
	return new Promise(async (resolve,reject) =>{
		Request.post('/boss/company/list',params).then(res=>{
			resolve(res.data)
		})
	})
}

export const updateRemark = (params,callback)=>{ // 
	return new Promise(async (resolve,reject) =>{
		Request.post('/qy-wechat/update/remark',params).then(res=>{
			resolve(res.data)
		})
	})
}

export const get_meetings_list = (params,callback)=>{ // 
	return new Promise(async (resolve,reject) =>{
		Request.post('/qy-wechat/get/meeting_list',params).then(res=>{
			resolve(res.data)
		})
	})
}




